package com.yzh.dxpro.p8.taskEight;

import java.io.IOException;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import com.yzh.dxpro.p1.clear.TProperties;
public class EightMapper extends Mapper<LongWritable,Text,Text,Text>{

	@Override
	protected void map(LongWritable key, Text value, Mapper<LongWritable, Text, Text, Text>.Context context)
			throws IOException, InterruptedException {
		//System.out.println("~~~~~~~~map1");//value:000042000000000000|513042498594(用户ID)|23（pv值）
		String[] values = value.toString().split(TProperties.getValue("fileoutsplit"));
		StringBuffer k = new StringBuffer();
		k.append(values[0]).append(TProperties.getValue("outfilesplit")).append(values[3]);
		Text k1 = new Text(k.toString());
		//Text v =new Text(values[1]+TProperties.getValue("outfilesplit")+values[2]+TProperties.getValue("outfilesplit")+values[3]);
		StringBuffer sb = new StringBuffer();
		sb.append(values[1]).append(TProperties.getValue("outfilesplit"))
		.append(values[2]);
		Text v = new Text(sb.toString());
		context.write(k1, v);
	}
}